<template>
	<view>
		<view class="protocol-page">
			<view class="">
				{{protocolMsg.title}}
			</view>
			<view class="">
				<jyf-parser :html="content"></jyf-parser>
			</view>
		</view>
	</view>
</template>

<script>
	
	import jyfParser from "@/components/jyf-parser/jyf-parser";
	
	export default{
		components: {
			jyfParser
		},
		data(){
			return{
				protocolMsg:'',
				store_id:""
			}
		},
		onLoad(option) {
			let store_id = parseInt(option.store_id,10);
			console.log('进入了onload 获取url的store_id',store_id)
			if(!store_id > 0){
				store_id = uni.getStorageSync('store_id')?parseInt(uni.getStorageSync('store_id'),10):0
			}else{
				uni.setStorageSync('store_id', store_id)
			}
			
			this.store_id = parseInt(store_id,10)
			this.$store.commit('updateStoreId',store_id)
			this.protocolMsg = uni.getStorageSync('protocolContent')
			console.log(this.protocolMsg)
			document.title = this.protocolMsg.title;
			let content = this.protocolMsg.content;
			content = content.replace(/\r\n/g,"<br>");
			content = content.replace(/\n/g,"<br>");
			this.content = content
			
			if (/ip(hone|od|ad)/i.test(navigator.userAgent)) {
				var i = document.createElement('iframe');
				i.src = '/favicon.ico';
				i.style.display = 'none';
				i.onload = function() {
					setTimeout(function(){
						i.remove();
					}, 1)
				}
				document.body.appendChild(i);
			}
		}
	}
</script>

<style>
	page{
		background: #F3F3F4;
	}
	.protocol-page{
		width: 100%;
		background: #FFFFFF;
		padding: 30upx;
		box-sizing: border-box;
	}
	.protocol-page>view:first-child{
		text-align: center;
		color: #333333;
		font-size: 32upx;
		text-align: center;
		margin-bottom: 20upx;
	}
	.protocol-page>view:last-child{
		color: #666666;
		font-size: 28upx;
		text-indent: 56upx;
	}
</style>
